1. Fields of the Invention
The present invention relates generally to an application server and more particularly to an application server that can prevent CPU resource exhaustion from hung threads.
2. Description of the Prior Art
A problem arises when faulty code executing in a computer device causes an infinite loop and take up CPU cycles without doing anything useful. Furthermore, subsequent calls to the threads executing the faulty code will result in numerous hung thread states or conditions. As a consequence, a hosted environment, (i.e., application server such as Websphere® Application Server) can be brought down to a halt due to CPU exhaustion.
Klemm et al (U.S. Pat. No. 7,243,267) discloses a JAS (Java Application Supervisor) that can provide automatic failure detection, automatic failure recording, and automatic failure recovery. The JAS receives process event notifications from a JRE
(Java Runtime Environment) and determines whether an execution problem, or failure, has occurred. In response to such an event, the JAS executes specified actions that attempt to recover from detected failures and to restore the availability of the target application quickly and automatically.
An IBM technical article “Developing a client to determine a hung thread problem” written by James Kochuba on Dec. 15, 2004 address thread monitors in WAS (Websphere ( Application Server) that report threads that may be hung. However, the thread monitors do not proactively perform steps to mitigate the effect of the hung threads in the overall application server. If the thread monitors' warnings go unnoticed, the hung threads will eventually overwhelm the system and take up all the CPU cycles available.
Therefore, it would be highly desirable to provide a system and method for guaranteeing that a hung thread condition will not take over a certain fraction of executing CPU cycles, leaving good threads to be responsive and minimally affected by other threads that invoke the faulty code.